﻿using CleanArchitecture.Core.SharedKernel;
using System;

namespace CleanArchitecture.Infrastructure.Entities.System.DataDic
{
    /// <summary>
    /// Represents a setting
    /// </summary>
    public partial class SystemDataDicTree : BaseEntity
    {
        #region Field
        private string _displayName;
        #endregion Field

        #region Ctor
        /// <summary>
        /// Ctor
        /// </summary>
        public SystemDataDicTree()
        {
        }
        #endregion

        #region Property
        /// <summary>
        /// 数据字典树父级Id
        /// </summary>
        public int ParentId { get; set; }

        /// <summary>
        /// 数据字典分组类型：
        /// Organize 组织机构
        /// ModuleButton 系统模块分配按钮
        /// </summary>
        public EntityEnumConfig.DataDicGroup GroupType { get; set; }

        /// <summary>
        /// 数据字典分组下的类型分类
        /// 1.所有系统模块将从数据字典中获取所有功能按钮，通过分配按钮使系统模块对其中数据进行操作
        /// 分系统模块和业务模块
        /// 2.所有客户端ClientApp站点数据从数据字典获取 
        ///  当DataDicTree DataDicGroup为 ClientApp时定义站点客户端类类型
        ///  根节点(ParentId = 0)的DataType指定默认客户端站点
        /// </summary>
        public EntityEnumConfig.DataType? DataType { get; set; }

        /// <summary>
        /// 数据字典树功能名称
        /// </summary>
        public string DataDicTreeName { get; set; }

        public string DisplayName
        {
            get { return string.IsNullOrEmpty(_displayName) ? DataDicTreeName : _displayName; }
            set { _displayName = value; }
        }

        public int DisplayOrder { get; set; }

        public EntityEnumConfig.YesorNo IsActive { get; set; }

        public DateTime CreatedOnTimeUtc { get; set; }
        #endregion
        
    }
}
